<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客</title>
    <style>
    </style>
</head>

<body>
    <div>
        <table>
            <tr>
                <input type="text" placeholder="查找博客标题、摘要、内容、分类、作者" id="keyword">
                <input type="button" value="查找" onclick="Query()">
                <input type="button" value="新增" onclick="Insert()">
            </tr>
            <tr>
                <td>ID</td>
                <td>标题</td>
                <td>摘要</td>
                <td>内容</td>
                <td>分类</td>
                <td>作者</td>
                <td>发表时间</td>
                <td>操作</td>
            </tr>

        </table>
    </div>

    <script src="./js/jquery-3.6.0.min.js"></script>
    <script src="./js/fn.js"></script>
    <script>
        let tb = $('table');
        $(() => {
            $.get('http://localhost:8080/blog', (res) => {
                res.forEach(item => {
                    tb.append(`
                        <tr>
          <td>${item.id}</td>
          <td>${item.title}</td>
         <td>${item.digest}</td>
        <td>${item.text}</td>
        <td>${item.classify}</td>
           <td>${item.author}</td>
        <td>${item.updatedAt}</td>
                            <td>
                                <input type="button" value="修改" onclick="Update(${item.id})">
                                <input type="button" value="删除" onclick="Delete(${item.id})">
                            </td>
                        </tr>
                    `)
                });
            })
        })

        
    </script>
</body>

</html>